package com.csdj.t309.utils;

import java.util.Random;

public class RandomUtil {
    public final static String CHARS = "abcdefghijklmnopqrestuvwxyzABCDEFGHIJKMLNOPQRSTUVWXYZ0123456789";
    public final static String NUMS = "0123456789";

    public static String genRandStr(int n){
        StringBuilder sb = new StringBuilder();
        Random random = new Random();
        for (int i = 0; i < n; i++) {
            sb.append(CHARS.charAt(random.nextInt(CHARS.length())));
        }
        return sb.toString();
    }

    public static String genPhone(){
        StringBuilder sb = new StringBuilder("1");
        Random random = new Random();
        for (int i = 0; i < 10; i++) {
            sb.append(NUMS.charAt(random.nextInt(NUMS.length())));
        }
        return sb.toString();
    }

    public static int genRoleId(){
        return new Random().nextInt(10);
    }

    public static void main(String[] args) {
//        System.out.println((char)0x4e00);

    }
}
